#include <queue>
#include <iostream>

using namespace std;

struct Customer
{
    string name;
    bool isFemale;
    int age;
    Customer(string inputName, bool inputSex, int inputAge)
    {
        name = inputName;
        isFemale = (inputSex) ? true:false;
        age = inputAge;
    }

    bool operator < (const Customer& anotherCustomer ) const
    {
        //判断年龄
        if(age < anotherCustomer.age)
            return true;
        if(age == anotherCustomer.age and !isFemale)
            return true;
        return false;
    }
};

int main(int argc, char const *argv[])
{
    Customer c1("zhangsan", false, 18);
    Customer c2("lisi", false, 99);
    Customer c6("xiamei", true, 38);
    Customer c3("popo", true, 99);
    Customer c4("wangxiaomei", true, 18);
    Customer c5("zhaoliu", false, 40);
    priority_queue<Customer>myqueue;
    myqueue.push(c1);
    myqueue.push(c2);
    myqueue.push(c3);
    myqueue.push(c4);
    myqueue.push(c5);
    myqueue.push(c6);
    //输出
    cout << myqueue.size() << endl;
    while(!myqueue.empty())
    {
        cout << myqueue.top().name << " " << myqueue.top().isFemale << endl;
        myqueue.pop();
    }
    cout << myqueue.size() << endl;
    return 0;
}
